package com.leetcode;

import java.util.HashSet;
import java.util.Set;

/**
 * TODO
 *
 * @author lefly
 * @version 1.0
 * @classname No217
 * @description
 * @date 2021/1/29 上午11:48
 */
public class No217 {
    public static void main(String[] args) {
        int[] nums = {1,1,1,3,3,4,3,2,4,2};
        boolean res = containsDuplicate(nums);
        System.out.println(res);
    }

    public static boolean containsDuplicate(int[] nums) {
        if(nums == null || nums.length < 2){
            return false;
        }
        Set<Integer> s = new HashSet<>();
        for (int num:nums){
            s.add(num);
        }
        return s.size() != nums.length;
    }

}
